package de.dhbw_stuttgart.wi2011i.outofapples.persistence;

import java.util.Collection;
import java.util.UUID;

import de.dhbw_stuttgart.wi2011i.outofapples.dtos.ShoppingItem;
import de.dhbw_stuttgart.wi2011i.outofapples.dtos.ShoppingList;
import de.dhbw_stuttgart.wi2011i.outofapples.dtos.UserDTO;

public interface Einkaufsblock {
	public interface ChangeCallback {
		void blockChangeOccured();
		void listChangeOccured(UUID id);
		void itemChangeOccured(UUID id);
		void userChangeOccured(String id);
	}
	public abstract class ChangeCallbackBase implements ChangeCallback {
		public void blockChangeOccured() {
		}

		public void listChangeOccured(UUID id) {
		}

		public void itemChangeOccured(UUID id) {
		}

		public void userChangeOccured(String id) {
		}
	}
	
	Collection<UserDTO> getUsers();
	UserDTO getUserByName(String username);
	UserDTO getCurrentUser();

	Collection<ShoppingList> getLists();
	ShoppingList getListById(UUID id);
	
	void addList(ShoppingList list);
	void delete(ShoppingList item);
	void update(ShoppingList item);

	Collection<ShoppingItem> getItems(ShoppingList list);
	ShoppingItem getItemById(UUID id);
	
	void addItem(UUID parentId, ShoppingItem item);
	void update(ShoppingItem item);
	void deleteItem(ShoppingItem item);

	void shareList(ShoppingList liste, String username);

	void registerChangeCallback(ChangeCallback callback);
	void unregisterChangeCallback(ChangeCallback callback);
}
